use  "${replication}\data\for_census_analysis.dta", clear



estimates clear

global absorb "i.s_code"
global cluster "sd_code"
global final_year 2010


global depvars ""

foreach var in p_sch m_sch s_sch college s_s_sch {
	gen delta_`var'=min(max(pc11_vd_`var'-pc01_vd_`var',0),1)
	global depvars "$depvars delta_`var'"
}

foreach var in  ph_cntr drnk_wat_f post_off phone {
	gen delta_`var'=min(max(`var'_1_2011_d-`var'_1_2001_d,0),1)
	global depvars "$depvars delta_`var'"
}


foreach var of varlist $depvars{
	reghdfe `var'     elec_by_${final_year} road_by_${final_year} elecXroad_by_${final_year}  , absorb( $absorb) cluster($cluster)
	qui estadd ysumm, mean
	qui estimate store `var'
	
}

estimates table _all , keep(*by*) stats(N $terms ymean) star(.1 .05 .01)
